package com.swak.vertx.config;

import java.util.List;

import com.swak.Constants;

import io.vertx.core.VertxOptions;
import io.vertx.core.http.ClientAuth;
import io.vertx.core.http.HttpServerOptions;
import lombok.Getter;
import lombok.Setter;

/**
 * Vertx 的全局配置， 对应 VertxProperties 中的配置项
 * 
 * @author DELL
 */
@Getter
@Setter
public class VertxConfig extends VertxOptions {

	/**
	 * 全局的IP， 端口配置
	 */
	private String host = null;
	private int port = 8888;
	private int webSocketPort = 8889;
	private int webSocketHeartbeatMs = 60 * 1000 * 3;

	/**
	 * 开启Http 压缩
	 */
	private boolean compressionSupported;
	private int compressionLevel = -1;

	/**
	 * 权限验证
	 */
	private String keyStorePath;
	private String keyStorePass = "secret";
	private String keyStoreAlgorithm = "HS256";
	private String tokenName = Constants.TOKEN_NAME;
	private Integer tokenExpiresInSeconds = null;

	/**
	 * 文件上传相关
	 */
	private String uploadDirectory = "file:uploads/";
	private int bodyLimit = -1;
	private boolean deleteUploadedFilesOnEnd = false;

	/**
	 * 设置服务器证书
	 */
	private boolean useSsl;
	private boolean useAlpn;
	private List<String> keyPaths;
	private List<String> certPaths;
	private ClientAuth clientAuth = ClientAuth.NONE;

	/**
	 * 消息传递
	 */
	private int sendTimeout = 5 * 60 * 1000;

	/**
	 * 表单提交
	 */
	private int maxHeaderSize = HttpServerOptions.DEFAULT_MAX_HEADER_SIZE;
	private int maxFormAttributeSize = HttpServerOptions.DEFAULT_MAX_FORM_ATTRIBUTE_SIZE;
}
